/*
*******************************************************************************
**
**  Filename:       seft_util.h
**  Revised:        Date: 2012-02-20
**  Revision:       Revision: 0.1
**
**  Description:	header files for utility functions
**
**  Notes:
**
*******************************************************************************
*/
#ifndef _SEFT_UTIL_
#define _SEFT_UTIL_

#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>

#include "seft_include.h"


/*
*******************************************************************************
**  Type define
*******************************************************************************
*/

typedef unsigned char	  *puint8_t;
typedef unsigned short	  *puint16_t;
typedef unsigned int		  *puint32_t;

typedef signed char		  *pint8_t;
typedef signed short		  *pint16_t;
typedef signed int		  *pint32_t;

#ifndef TRUE
#define TRUE	(1)
#endif

#ifndef FALSE
#define FALSE	(0)
#endif

/*
*******************************************************************************
**  Type define
*******************************************************************************
*/
typedef void* (*pthread_routine_t)(void*);


/*
*******************************************************************************
**  Function define
*******************************************************************************
*/

void _seft_log(const char* function_name, const char* format, ...);


//int seft_get_conf_value(string& key, string& value);

#ifdef	DEBUG
#define seft_log(...)	\
	_seft_log(__FUNCTION__, __VA_ARGS__);
#else
#define seft_log(...) {}
#endif

#ifdef	DEBUG
#define ENTER()			printf("\n%s %s <enter>\n", strtok(seft_get_time(), "\n"), __FUNCTION__);fflush(NULL)
#define LEAVE()			printf("%s %s <leave>\n", strtok(seft_get_time(), "\n"), __FUNCTION__);fflush(NULL)
#else
#define ENTER() {}
#define LEAVE() {}
#endif

#if 0
#define seft_print(...) \
	printf("%s%s", get_time(), __FUNCTION__); \
	printf(__VA_ARGS__)
#endif

#define MEMBER_OFFSET(type, member) ((uint32_t)&(((type*)0)->member))

#endif
